
import cooApp from 'coolink-ts'
import homePage from './homePage'

interface IPageInformation {
    pageName: string,
    pageBuilder: Function,
    isDefault: boolean,
    isNotFound: boolean,
    useInject?: boolean,
}

const pageList: IPageInformation[] = [
    {
        pageName: 'homePage',
        pageBuilder: () => homePage,
        isDefault: true,
        isNotFound: false,
        useInject: false,
    },
];

function registerAllPage() {
    pageList.forEach((pageInfo) => {
        cooApp.registerPage(
            pageInfo.pageName,
            pageInfo.pageBuilder,
            {
                isDefault: pageInfo.isDefault,
                isNotFound: pageInfo.isNotFound,
            }
        );
        //
        if (pageInfo.useInject) {
            cooApp.injectRoute({ pageName: pageInfo.pageName })
        }
    })
}

export default {
    registerAllPage
}


